package com.heima.admin.controller.v1;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news")
public class AdAuthNewsController {

    @Autowired
    private IWemediaClient wemediaClient;

    @PostMapping("/list_vo")
    public ResponseResult findList(@RequestBody NewsAuthDto dto){
        return wemediaClient.findNewsList(dto);
    }

    @GetMapping("/one_vo/{id}")
    public ResponseResult findOne(@PathVariable Integer id){
        return wemediaClient.findNewsOne(id);
    }

    @PostMapping("/auth_fail")
    public ResponseResult updateAuthFailNews(@RequestBody NewsAuthDto dto) {
        ResponseResult result = wemediaClient.authFailNews(dto);
        return result;
    }

    @PostMapping("/auth_pass")
    public ResponseResult updateAuthPassNews(@RequestBody NewsAuthDto dto) {
        ResponseResult result = wemediaClient.authPassNews(dto);
        return result;
    }
}
